package com.edu.service.impl;

import com.edu.component.PageBean;
import com.edu.component.QueryParam;
import com.edu.dao.StudentMapper;
import com.edu.dao.TeacherMapper;
import com.edu.service.TeacherService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TeacherServiceImpl implements TeacherService {

    @Autowired
    private TeacherMapper teacherMapper;
    @Override
    public PageBean listPage(QueryParam param) {
        //{1}开启分页拦截的功能
        Page retPage = PageHelper.startPage(param.getPage(),
                param.getLimit(), true);
        //{2}执行查询.[学生完成]
        teacherMapper.queryList( param.getParam() );
        //{3}把 Page 装载进 PageBean 并返回。
        return new PageBean( retPage );
    }
}
